extends Node2D
@onready var sprite_2d_2: Sprite2D = $Sprite2D2
@onready var texture_rect: TextureRect = $HSplitContainer/TextureRect
@onready var texture_rect_2: TextureRect = $HSplitContainer/TextureRect2
@onready var timer: Timer = $Timer
@onready var test_10: Node2D = $Test10
var time   = 15
var time_0 = load("res://resource/ui/00C438F80000.png")
var time_1 = load("res://resource/ui/000B29F40000.png")
var time_2 = load("res://resource/ui/CCA124FE0000.png")
var time_3 = load("res://resource/ui/8F1C6C0C0000.png")
var time_4 = load("res://resource/ui/04DAF93C0000.png")
var time_5 = load("res://resource/ui/05F221160000.png")
var time_6 = load("res://resource/ui/6F2478B40000.png")
var time_7 = load("res://resource/ui/193EE9090000.png")
var time_8 = load("res://resource/ui/39A3DE450000.png")
var time_9 = load("res://resource/ui/4E8329060000.png")



func _ready() -> void:
	test_10.position=Vector2(300,300)
	test_10.setImage("res://animation/test1.tres", "stand_8", "燕山雪", 0, true)


func _process(delta: float) -> void:
	pass


func _on_timer_timeout() -> void:
	print("_on_timer_timeout")
	time -= 1
	var number_as_string = str(time)
	if time == 0:
		timer.stop()
		setIsdf(texture_rect, 0)
		setIsdf(texture_rect_2, 0)
	elif time>9:
		var first = number_as_string.substr(0, 1)
		setIsdf(texture_rect, int(first) )
		var second = number_as_string.substr(1)
		print(""+str(first)+"  "+ str(second) )
		setIsdf(texture_rect_2, int(second) )
	else:
		setIsdf(texture_rect, 0)
		setIsdf(texture_rect_2, int(number_as_string) )


func setIsdf(texture_rect: TextureRect, number: int) -> void:
	if number == 1:
		texture_rect.texture = time_1
	elif number == 2:
		texture_rect.texture = time_2
	elif number == 3:
		texture_rect.texture = time_3
	elif number == 4:
		texture_rect.texture = time_4
	elif number == 5:
		texture_rect.texture = time_5
	elif number == 6:
		texture_rect.texture = time_6
	elif number == 7:
		texture_rect.texture = time_7
	elif number == 8:
		texture_rect.texture = time_8
	elif number == 9:
		texture_rect.texture = time_9
	else:
		texture_rect.texture = time_0
	
